#include "boundingsphere.h"

BoundingSphere::BoundingSphere(float aRayon, Vectorf *aTranslation)
{
    rayon=aRayon;
    translation=aTranslation;
    type=2;
}

int BoundingSphere::Collide(Enveloppe *env)
{
    if(env->type==1)         // AABB
    {
        AABB * b = (AABB *)(env);

        if((*translation- * b->translation).Norme()>rayon)
        {
            return 1;
        }
        return 0;
    }
    else if(type==2)    // Sphere
    {
        printf("fuck yeah \n");
        BoundingSphere * b= (BoundingSphere *)(env);
        translation->Print();
        b->translation->Print();
        if((*translation- * b->translation).Norme()<b->rayon)
        {
            printf("fuck yeah BIS \n");
            return 1;
        }
        return 0;
    }
    else if(type==3)    // Mesh
    {
        return 0;
    }
}
